<?php

$api = app('Dingo\Api\Routing\Router');
$moduleName = 'Market';

// 平台后台api
$api->version('v1', ['prefix' => 'admin-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Admin\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'] ;

	$api->resource('market/tenants', "TenantController", ['only' => $allMethod]);
	$api->post('/market/transactions', ['uses'=> "TransactionController@store"]);

	$api->post('/market/batch-buy', ['uses'=> "TransactionController@batchBuy"]);

	$api->get('/market/exchange/record/status', ['uses'=> "ExchangeRecordController@statusTotal"]);

	$api->resource('market/exchange/records', "ExchangeRecordController", ['only' => $allMethod]);
});

// 租户api
$api->version('v1', ['prefix' => 'tenant-api', 'namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Tenant\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];
});

// 普通用户api
$api->version('v1', ['namespace' => 'Modules\\'.$moduleName.'\Http\Controllers\Client\V1'], function ($api) {
	$allMethod = ['index', 'show', 'store', 'update', 'destroy'];

	// $api->get('/pages/{uuid}', ['uses'=> "PageController@show"]);

	// 批量转售（2021.11.13后写的转售相关api由asset模块转移到market模块）
	$api->post('market/resale/batch/confirm', ['uses'=> "ResaleController@batchConfirm"]);

	// 获取可置换的商品列表
	$api->post('/market/exchange/products', ['uses'=> "ProductController@index"]);

	// 兑换商品
	$api->post('/market/exchange/order/preview', ['uses'=> "ExchangeOrderController@preview"]);
	// 确认兑换商品
	$api->post('/market/exchange/order/confirm', ['uses'=> "ExchangeOrderController@confirm"]);

});